﻿/*
{
"状态":1,
"名称":"获取-公司信息",
"作者":"陈泽椿",
"创建时间":"2018-06-30",
"功能":"获取-公司信息",
"log": [
	{"date":"06-01" , "dev" :"hzhh" , "content" : ""}
]
}
*/

declare @sql varchar(max)
declare @company_name varchar(100)
declare @where varchar(max)
set @company_name = '{company_name}'
set @where = ''

if (@company_name <>'')
begin
	set @where += ' and company_name like ''%'+@company_name+'%'''
end
set @sql = '
select company_key,company_id,company_name,telphone,address,legal_person,convert(varchar(20),create_time,120)create_time,
convert(varchar(20),update_time,120)update_time from y_company where 1=1 {where} '
set @sql =replace(@sql,'{where}',@where)

exec(@sql)